package com.erp.order.purchasing.model;

import com.erp.hr.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;

/**
 * 采购申请 实体类
 * @Author: syz
 * @blame syz
 * @CreateTime: 2021/4/6
 */
@Data
@Entity
@DynamicInsert()
@DynamicUpdate()
@EqualsAndHashCode(callSuper = true)
@Table(name="purchasing_requisition", schema="erp")
public class PurchasingRequisition extends BaseModel {

    private static final long serialVersionUID = 1L;

    /**
     * 采购id
     */
    @Column(name = "purchasing_id")
    private Long purchasingId;

    /**
     * 编号
     */
    @Column(name = "code")
    private String code;

    /**
     * 标题
     */
    @Column(name = "title")
    @NotBlank(message="标题不能为空")
    private String title;

    /**
     * 采购类型
     */
    @Column(name = "type")
    @NotBlank(message="采购类型不能为空")
    private String type;

    /**
     * 申请公司代码
     */
    @Column(name = "company_code")
    private String companyCode;

    /**
     * 申请公司名称
     */
    @Column(name = "company_Name")
    private String companyName;

    /**
     * 申请部门代码
     */
    @Column(name = "department_code")
    private String departmentCode;

    /**
     * 申请部门名称
     */
    @Column(name = "department_name")
    private String departmentName;

    /**
     * 申请人名称
     */
    @Column(name = "create_user_name")
    private String createUserName;

    /**
     * 手机号码
     */
    @Column(name = "tel")
    private String tel;

    /**
     * 固定电话
     */
    @Column(name = "land_line")
    private String landLine;

    /**
     * 电子邮箱
     */
    @Column(name = "mail_box")
    private String mailbox;

    /**
     * 期望交货时间
     */
    @Column(name = "scheduled_time")
    @NotBlank(message="期望交货时间不能为空")
    private String scheduledTime;

    /**
     * 采购原因
     */
    @Column(name = "reason")
    @NotBlank(message="采购原因不能为空")
    private String reason;

    /**
     * 收货地址
     */
    @Column(name = "address")
    @NotBlank(message="收货地址不能为空")
    private String address;

    /**
     * 附件
     */
    @Column(name = "accessory")
    private String accessory;

    /**
     * 是否允许撤回
     */
    @Column(name = "allowed_withdraw")
    private String allowedWithdraw;

    /**
     * 状态
     */
    @Column(name = "status")
    private String status;

    /**
     * 附言
     */
    @Column(name = "remark")
    private String remark;

    /**
     * id集合
     */
    @Transient
    private List<Long> ids;

    /**
     * 详情
     */
    @Transient
    private List<PurchasingRequisitionDetail> subs;

    /**
     * 附件map
     */
    @Transient
    private Map<String, String> fileMap;
    
}